// ConnectionHandler.java
package com.mytech.cslive.communication_handlers;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketException;

import com.mytech.cslive.commands.Command;

public abstract class ConnectionHandler {
	
	/**
	 * Create a new socket binded to ipAddress and port
	 * @param ipAddress
	 * @param port
	 * @throws SocketException
	 */
	abstract void connect(InetSocketAddress... socketAddress) throws SocketException;
	abstract void disconnect();
	abstract void sendData(byte[] data) throws IOException;
	
	public void sendCommand(Command command) throws IOException {
		this.sendData(command.toByteArray());
	}
	/**
	 * Releasing the addresses for other connections
	 */
	abstract public void releaseAddresses();
} 
